package com.bobo.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.bobo.dao.GoodsMapper;
import com.bobo.domain.Brand;
import com.bobo.domain.Goods;
import com.bobo.domain.Product;
import com.bobo.domain.Trail;
import com.bobo.service.GoodsService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

@Service
public class GoodsServiceImpl implements GoodsService {
	@Autowired
	GoodsMapper goodsMapper;

	@Override
	public PageInfo<Goods> listGoods(Goods goods, Integer pageNum, Integer pageSize) {
		PageHelper.startPage(pageNum, pageSize);
		List<Goods> list = goodsMapper.listGoods(goods);
		return new PageInfo<Goods>(list);
	}

	@Override
	public List<Brand> listBrand() {
		// TODO Auto-generated method stub
		return goodsMapper.listBrand();
	}

	@Override
	public List<Product> ListProduct() {
		// TODO Auto-generated method stub
		return goodsMapper.ListProduct();
	}

	@Override
	public Goods get(Integer id) {
		// TODO Auto-generated method stub
		return goodsMapper.get(id);
	}

	@Override
	public int update(Goods goods) {
		// TODO Auto-generated method stub
		return goodsMapper.update(goods);
	}

	@Override
	public int addTrail(Trail trail) {
		// TODO Auto-generated method stub
		return goodsMapper.addTrail(trail);
	}

	@Override
	public List<Trail> getTrailTotal() {
		// TODO Auto-generated method stub
		return goodsMapper.getTrailTotal();
	}

	@Override
	public List<Trail> getTraiInfo(Integer minute) {
		// TODO Auto-generated method stub
		return goodsMapper.getTraiInfo(minute);
	}

	@Override
	public int deleteById(Integer id) {
		// TODO Auto-generated method stub
		return goodsMapper.deleteById(id);
	}

	@Override
	public int add(Goods goods) {
		// TODO Auto-generated method stub
		return goodsMapper.add(goods);
	}

}
